<?php

require_once 'Zend/View/Helper/Abstract.php';

class Core_View_Helper_RenderModuleForm extends Zend_View_Helper_Abstract
{
    /**
     * comments
     */
    public function renderModuleForm($module, $action, $parameters)
    {
        $dir      = APPLICATION_PATH . '/modules/' . $module . '/views/scripts';
        $helpers  = APPLICATION_PATH . '/modules/' . $module . '/views/helpers';
        $path     = '/public/' . $action . '.form.phtml';
        $fullPath = $dir . $path;
        if (file_exists($fullPath)) {
            $this->view->addScriptPath($dir);
            $this->view->addHelperPath($helpers);
            $this->view->formParams = $parameters;
            return $this->view->render($path);
        }
    }
}